package com.todo.biz.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/3/14 20:02
 * @description
 */
@Getter
@AllArgsConstructor
public enum CommentTypeEnum {

    CONTENT(1, "CONTENT", "内容评论"),
    COMMENT(2, "COMMENT", "子评论"),

    ;

    private static Map<Integer, CommentTypeEnum> typeMap = Arrays
            .stream(CommentTypeEnum.values())
            .collect(Collectors.toMap(CommentTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static CommentTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
